home *** CD-ROM | disk | FTP | other *** search
/ Scene 96 / Scene 96 International Edition (Zyklop Software) (Disc 2) (1997).iso / misc / coding / e_os208 / example7 / example7.asm next >
Assembly Source File  |  1996-06-09  |  4KB  |  155 lines

  1. ;╔══════════════════════════════════════════════════════════════════════════╗
  2. ;║                                                                          ║
  3. ;║ Load a SCX compress picture and display in 320x200 256 colors            ║
  4. ;║                                                                          ║
  5. ;║ with hard scrolling                                                      ║
  6. ;║                                                                          ║
  7. ;║ Tabs : 13 21 29 37                                                       ║
  8. ;║                                                                          ║
  9. ;╚══════════════════════════════════════════════════════════════════════════╝
  10.  
  11. Locals
  12. .386
  13. CODE32 SEGMENT PUBLIC PARA 'CODE' USE32
  14. ASSUME  CS:CODE32,DS:CODE32,ES:CODE32
  15.  
  16. INCLUDE ..\RESOURCE\EOS.INC
  17.  
  18. File_Pic            db '..\data\test320.DLZ',0
  19. Addr_Pic            dd 0
  20.  
  21. scroll_position     dw 80
  22. leftright           db 0
  23.  
  24. Start32:
  25.             mov ah,Load_Internal_File
  26.             mov edx,O File_Pic
  27.             Int_EOS                         ; Load the file even if the program isn't link
  28.             mov [Addr_Pic],eax
  29.  
  30.             mov ax,13h                      ; Set VGA 320*200 256c
  31.             DosInt 10h
  32.  
  33.             mov dx,3ceh                     ; Enable hard scrolling
  34.     mov al,5
  35.     out dx,al
  36.     inc dx
  37.     in al,dx
  38.     and al,11101111b
  39.     out dx,al
  40.     dec dx
  41.     mov al,6
  42.     out dx,al
  43.     inc dx
  44.     in al,dx
  45.     and al,11111101b
  46.     out dx,al
  47.     mov dx,3c4h
  48.     mov al,4
  49.     out dx,al
  50.     inc dx
  51.     in al,dx
  52.     and al,11110111b
  53.     or al,4
  54.     out dx,al
  55.     mov dx,3d4h
  56.     mov al,14h
  57.     out dx,al
  58.     inc dx
  59.     in al,dx
  60.     and al,10111111b
  61.     out dx,al
  62.     dec dx
  63.     mov al,17h
  64.     out dx,al
  65.     inc dx
  66.     in al,dx
  67.     or al,01000000b
  68.     out dx,al
  69.  
  70.             mov ax,0f00h+0002h              ; Clear the screen
  71.             mov dx,3c4h
  72.             out dx,ax
  73.             mov edi,[_0a0000h]
  74.             mov ecx,80*200
  75.             xor eax,eax
  76.             rep stosd
  77.  
  78.             mov esi,[Addr_Pic]              ; Set palette
  79.             add esi,10                      ; Header Offset of SCX
  80.             mov dx,3c8h
  81.             xor al,al
  82.             out dx,al
  83.             mov ecx,256*3
  84.             inc dl
  85.             cli
  86. @@lp:       outsb                           ; rep outsb do not work with all cards
  87.             loop @@lp
  88.             sti
  89.  
  90.             movzx edi,scroll_position       ; Copy picture into VRAM
  91.             add edi,[_0a0000h]
  92.             mov dx,3c4h
  93.             mov ecx,200
  94. @@ag:
  95.             push ecx
  96.             mov ecx,80
  97. @@plan:
  98.             mov ax,0100h+0002h
  99.             rept 4
  100.             out dx,ax
  101.             push ax
  102.             lodsb
  103.             mov Byte ptr [edi],al
  104.             pop ax
  105.             shl ah,1
  106.             endm
  107.             inc edi
  108.             loop @@plan
  109.             add edi,160
  110.             pop ecx
  111.             loop @@ag
  112.  
  113.             mov ax,7813h                    ; Init Horizontal scrolling
  114.     mov dx,03d4h
  115.     out dx,ax
  116.  
  117. @@again:
  118.             mov ah,Wait_Vbl                 ; Wait the vertical retrace
  119.             Int_EOS
  120.  
  121.             cli                             ; Scrolling...
  122.             mov bx,scroll_position
  123.     mov ah,bh
  124.     mov al,0ch
  125.     mov dx,3d4h
  126.     out dx,ax
  127.     mov ah,bl
  128.     mov al,0dh
  129.     out dx,ax
  130.     sti
  131.  
  132.             mov ah,1                        ; Test if a key is pressed
  133.             DosInt 16h
  134.             jnz @@end
  135.  
  136.             cmp leftright,0
  137.             jne @@decr
  138.             inc scroll_position             ; Inc scrolling
  139.             cmp scroll_position,160
  140.             jne @@again
  141.             mov leftright,1
  142. @@decr:
  143.             dec scroll_position             ; dec scrolling
  144.             cmp scroll_position,0
  145.             jne @@again
  146.             mov leftright,0
  147.             jmp @@again
  148.  
  149. @@end:
  150.             mov ax,4c00h                    ; Exit with Error Code 0
  151.             int 21h                         ; and Automaticly restore video Mode
  152.  
  153.             CODE32 ENDS
  154.  
  155.             END